#!/usr/bin/python

# inputdialog.py

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
a = 3.156423

class InputDialog(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(300, 300, 350, 80)
        self.setWindowTitle('InputDialog')
        self.variable = a
        self.button = QtGui.QPushButton('Dialog', self)
        self.button.setFocusPolicy(QtCore.Qt.NoFocus)
        
        self.button.move(20, 20)
        self.connect(self.button, QtCore.SIGNAL('clicked()'), self.showDialog)
        self.setFocus()

        self.label = QtGui.QLineEdit(self)
        self.label.move(130, 22)
        
        


    def showDialog(self):
        value, ok = QtGui.QInputDialog.getDouble(self, 'Change Variable Value', 'Enter new value: ',\
                    self.variable, -2147483647, 2147483647, len(self.variable.__str__()))
        if ok:
            self.label.setText(unicode(str(value)))
            a = value


app = QtGui.QApplication(sys.argv)
icon = InputDialog()
icon.show()
app.exec_()
